package com.pm.service.official.impl;

import com.pm.entity.po.official.OfficialRankStatistics;
import com.pm.mapper.official.OfficialRankStatisticsMapper;
import com.pm.service.impl.BaseServiceImpl;
import com.pm.service.official.OfficialRankStatisticsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * @program: pm_info_api
 * @description:党政一把手排名统计
 * @author: xzj
 * @create: 2020-08-19 17:46
 **/
@Service
public class OfficialRankStatisticsServiceImpl extends BaseServiceImpl<OfficialRankStatistics> implements OfficialRankStatisticsService {
    @Autowired
    OfficialRankStatisticsMapper officialRankStatisticsMapper;
    @Resource
    private void setBaseMapper(OfficialRankStatisticsMapper officialRankStatisticsMapper) {
        super.setBaseMapper(officialRankStatisticsMapper);
    }
    @Override
    public Integer addOne(OfficialRankStatistics officialRankStatistics) {
        if (officialRankStatistics.getId()!=null){
            officialRankStatisticsMapper.removeOne(officialRankStatistics.getId());
            return officialRankStatisticsMapper.addOne(officialRankStatistics);
        }
        return officialRankStatisticsMapper.addOne(officialRankStatistics);
    }
}
